﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Catering_Operation;
using System.Data;

namespace Catering_Rules
{
    public class ContactsBLL
    {
        ContactsDAL contact = new ContactsDAL();
        public DataTable GetContactsForArea(string id)
        {
            if (id.Equals("-10"))
            {
                return contact.GetContactsForArea(null);
            }
            else
            {
                return contact.GetContactsForArea(id);
            }
        }

        public bool doUpdate(string areaid, string classid, string name, string sex, string jobtitle, string phonenum, string back, string temp1, string temp2, string id)
        {
            bool flag = false;
            int num = contact.Update(areaid, classid, name, sex, jobtitle, phonenum, back, temp1, temp2, id);
            if (num > 0)
            {
                flag = true;
            }
            return flag;
        }

        public bool doDel(string id)
        {
            bool flag = false;
            int num = contact.Del(id);
            if (num > 0)
            {
                flag = true;
            }
            return flag;
        }

        public bool doAdd(string areaid, string classid, string name, string sex, string jobtitle, string phonenum, string back, string temp1, string temp2)
        {
            bool flag = false;
            int num = contact.Add(areaid, classid, name, sex, jobtitle, phonenum, back, temp1, temp2);
            if (num > 0)
            {
                flag = true;
            }
            return flag;
        }

        /// <summary>
        /// 获取单个用户信息
        /// </summary>
        /// <param name="id">用户ID</param>
        /// <returns></returns>
        public DataTable GetContactsForUserId(string id)
        {
            return contact.GetContactsForUserId(id);
        }
    }
}
